package kiwi.core.qualifiers.async;

import javax.interceptor.InterceptorBinding;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * The execution of methods annotated with this annotation is wrapped in a newly created thread that runs the method
 * and then terminates again.
 * <p/>
 * Be aware that asynchronous methods loose all context, i.e. there is no current user, no active transaction, no
 * current or active knowledge spaces, etc. Context has to be passed explicitly to the method, and transactions need
 * to be created manually.
 * <p/>
 * Note that methods annotated with @Asynchronous will always return "null". The return value of the method execution
 * will be logged on log level debug if it exists.
 * <p/>
 * User: sschaffe
 */
@InterceptorBinding
@Target({METHOD, TYPE})
@Retention(RUNTIME)
public @interface Asynchronous {
//
//    @Nonbinding
//    long timeout() default 0;
}
